<?php
/**
 * Created by Dumitru Russu
 * User: developer
 * Date: 8/24/12
 * Time: 2:41 PM
 * To change this template use File | Settings | File Templates.
 */
class Db_Cms_SkinFiles extends Common
{
    public static $tableName = TAB_SKIN_FILES;
    public static $dbFields = array(
        'id',
        'sf_skin_id',
        'sf_file_name',
        'sf_file_type',
        'sf_special_content',
        'sf_media',
        'sf_is_static',
        'sf_position',
        'deleted'
    );
    public static $positionField = 'sf_position';

    /**
     * @var Db_Cms_SkinFiles
     */
    public $objectArray;

    public $id;
    public $sf_skin_id;
    public $sf_file_name;
    public $sf_file_type;
    public $sf_special_content;
    public $sf_media;
    public $sf_is_static;
    public $sf_position;
    public $deleted;

    function __construct($value=NULL, $fieldName=NULL) {
        parent::__construct($value, $fieldName);
    }

    public static function getAllFilesBySkinId($skinId){
        $sql = "SELECT * FROM ?f WHERE `sf_skin_id` = ?d AND `deleted` = 0 ORDER BY `sf_position`;";
        return self::$DB->select($sql, TAB_SKIN_FILES, $skinId);
    }
}
